package com.bw.controller;

import com.bw.bean.Vo1;
import com.bw.bean.Vo2;
import com.bw.bean.Vo3;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {
    @Autowired
    VoService voService;
    @RequestMapping("list1")
    public Map list1(){
        List<Vo1> list1 = voService.list1();
        return SugarUtil.getLineData(list1);
    }

    @RequestMapping("list2")
    public Map list2(){
        List list = new ArrayList<>();
        list.add("课程名称");
        list.add("考试人次");
        list.add("平均分");
        list.add("平均用时");
        List<Vo2> list2 = voService.list2();
        return SugarUtil.getTablePlayData(list,list2);
    }

    @RequestMapping("list3")
    public Map list3(){
        Integer list3 = voService.list3();
        return SugarUtil.getFlipNumberData(list3);
    }

    @RequestMapping("list4")
    public Map list4(){
        List list = new ArrayList<>();
        list.add("课程名称");
        list.add("平均评分");
        list.add("评价人数");
        list.add("好评人数");
        list.add("好评率");
        List<Vo3> list4 = voService.list4();
        return SugarUtil.getTablePlayData(list,list4);
    }
}
